using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ACM.cmsarea08;
using ACM.cmsarea08.Controls;
using ACM.cmsarea08.Administration;


namespace ACM.cmsarea08.Administration.Core {
	public partial class BaseDGridPage :  ACM.cmsarea08.Administration.Core.AdminPage {
	public ACM.cmsarea08.Administration.Controls.MainButton adm_buttons;
	public ACM.cmsarea08.Administration.Controls.ListButton adm_button;
	
		public void PrintMessage(string message) {
			if(adm_buttons!=null) {
				adm_buttons.ShowResultMessage(message);
				return;
			} 
			if(adm_button!=null) {
				adm_button.ShowResultMessage(message);
				return;
			}
			
			if(this.Master is ListerPrivate) {
				if(((ListerPrivate)this.Master).adm_button!=null) {
					((ListerPrivate)this.Master).adm_button.ShowResultMessage(message);
					return;
				}
			} else if(this.Master is Plugins_Lister) {
				if(((Plugins_Lister)this.Master).adm_button!=null) {
					((Plugins_Lister)this.Master).adm_button.ShowResultMessage(message);
					return;
				}
			}
			
			HttpContext.Current.Response.Write("<hr>" + message + "<hr>");
		}
	
		protected override void OnPreInit(EventArgs e)
		{
			base.OnPreInit(e);
			//Response.Write("SONO PINO:" + ACM.cmsarea08.Users.CurrentUser.UserName);
			if(ACM.cmsarea08.Users.CurrentUser.SimpleAdmin==true) {
				if(this.Page.Master==null) return;
				if(string.IsNullOrEmpty(this.Page.MasterPageFile)) return;
				 string currentFile = this.Page.MasterPageFile;
				 if(currentFile.IndexOf("dummy")!=-1) return;
				 if(currentFile.IndexOf("administration/")!=-1) {
				 	currentFile = currentFile.Insert(currentFile.LastIndexOf("/administration/")+16,"dummy");
				 	//Response.Write("SONO UC:" +currentFile);
				 	this.Page.MasterPageFile = currentFile;
				 }
//				if(this.Page.Master!=null && !string.IsNullOrEmpty(this.Page.MasterPageFile))
//				 this.Page.MasterPageFile = "~/administration/dummylist_private.master";
			}
		}		
	}
	
}
